/* Ejercicio 5.16
   ejer5_16.c */
#include <stdio.h>

/* Prototypes */
long integerPower( long base, long exponent );

/* function main begins program execution */
int main( void )
{
    int a, b;

    printf( "Enter the base: " );
    scanf( "%d", &a );
    printf( "Enter the exponent: " );
    scanf( "%d", &b );
    printf( "The answer is: %ld\n", integerPower( a, b ) );
	return 0; /* indicate that program ended successfully */
} /* end function main */

/* Returns the value of base elevated to exponent */
long integerPower( long base, long exponent )
{
    long i, resp;

    resp = 1;

    for ( i = 1; i <= exponent; i++ ) {
        resp *= base;
    }

    return resp;
} /* end function integerPower */
